package reflect;

/**
 * @Author Zhouchb
 * @Create 2022-04-2022/4/3 :21:36
 * @Description
 */
interface IRental{
    public void rental();
}
class Landlord implements IRental{

    @Override
    public void rental() {
        System.out.println("我是房东，我要出租");
    }
}
class LandlordProxy implements IRental{
    private Landlord landlord;
    public LandlordProxy(Landlord landlord){
        this.landlord = landlord;
/*        try {
            //大的class实例
            Class clazz = Class.forName("reflect.Landlord");
            landlord = (Landlord) clazz.newInstance();
        } catch (Exception e) {
            e.printStackTrace();
        }*/
    }
    @Override
    public void rental() {
        blackHeart();
        landlord.rental();
        runRoad();
    }
    public void blackHeart(){
        System.out.println("我只管拉到人");
    }
    public void runRoad(){
        System.out.println("签约成功跑路");
    }
}
public class ProxyTest {
    public static void main(String[] args) {
        LandlordProxy landlordProxy = new LandlordProxy(new Landlord());
        landlordProxy.rental();
    }
}
